Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom rules that report on the absence of aggregates #1260

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

anderseknert
Copy link
Member

While custom aggregate rules would largely work before, those that report on the absence of data (like a rule named "allow") did not work. This as the aggregator sent nothing back in those caes — and contrary to the built-in rules, Regal had then no way of knowing in the next step that the aggregate report rules should be called even with no data.

I'm not super happy about the way we communicate this back to the Go side, but there's a lot I'm not happy about with regards to how aggregate data is shuffled back and forth. Some effort to fix that will however have to wait until later.

Fixes #1259

While custom aggregate rules would largely work before, those that report
on the absence of data (like a rule named "allow") did not work. This as
the aggregator sent nothing back in those caes — and contrary to the built-in
rules, Regal had then no way of knowing in the next step that the aggregate
report rules should be called even with no data.

I'm not super happy about the way we communicate this back to the Go side,
but there's a lot I'm not happy about with regards to how aggregate data
is shuffled back and forth. Some effort to fix that will however have to
wait until later.

Fixes #1259

Signed-off-by: Anders Eknert <anders@styra.com>
Comment on lines +227 to +229
_null_to_empty(x) := [] if {
x == null
} else := x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like a code golf opportunity, but I'm not in the mood right now 😉

@anderseknert anderseknert merged commit 743a65b into main Nov 14, 2024
5 checks passed
@anderseknert anderseknert deleted the fix-custom-agg-rules branch November 14, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example about aggregate rules seems not to work correctly
2 participants